package com.homework;

import java.util.Objects;

/**
 * 描述: TODO
 *
 * @author CodeYang
 * @version 2020/12/17 10:27
 */
public class CokeDrink extends Drink {

    /**
     * 配料
     */
    private String ingredients;


    public CokeDrink() {
    }

    public CokeDrink(String ingredients) {
        this.ingredients = ingredients;
    }

    public CokeDrink(String name, double capacity, String ingredients) {
        super(name, capacity);
        this.ingredients = ingredients;
    }

    @Override
    public void show() {
        super.show();
        System.out.println("配料信息为:"+ingredients);
    }

    public String getIngredients() {
        return ingredients;
    }

    public void setIngredients(String ingredients) {
        this.ingredients = ingredients;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        if (!super.equals(o)) return false;
        CokeDrink cokeDrink = (CokeDrink) o;
        return Objects.equals(ingredients, cokeDrink.ingredients);
    }

    @Override
    public int hashCode() {
        return Objects.hash(super.hashCode(), ingredients);
    }
}
